<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="author" content="wangbo">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Dom</title>
  <style>
    h1.red{
      border: 1px solid #ccc;
    }
  </style>
</head>
<body>
  <h1 class="red" name="dom" id="h1">我是h1</h1>
  <a  class="red" name="dom" href="#">我是a</a>
  <!-- dom document object model -->
  <script>
    // es6,获取的只有只有一个
    let myh1 = document.querySelector("h1.red")
    console.log(myh1)
    // 还是1,谁是第一个选择的就是谁
    let mycc = document.querySelector(".red")
    console.log(mycc)
    let myarr =document.querySelectorAll(".red")
    console.log(myarr)
    // 返回多个,返回的就是数组
    let mydd =document.querySelectorAll("#h1")
    console.log(mydd)
  </script>
</body>
</html>